import request from '@/utils/request'

export const selectOrdersByQueryinf = (queryinf, username) => {
  return request.get('/order/selectOrdersByQueryinf', {
    params: { queryinf: queryinf, username: username }
  })
}

export const delOderService = (id) => {
  return request.get('/order/delOrderById', {
    params: { id: id }
  })
}

export const addOderService = (params) => {
  return request.post('/order/addOrder', params)
}

export const editOderService = (id, state) => {
  return request.get('/order/editOrder', { params: { id: id, state: state } })
}

export const getOrdersByUsername = (username) => {
  return request.get('/order/getOrdersByUsername', {
    params: { username: username }
  })
}

export const getCodeService = (id, payment) => {
  if (payment === '微信支付') {
    return request.get('/order/getWeChatPay', { params: { id: id } })
  }
}

export const waitPayService = (id, payment) => {
  if (payment === '微信支付') {
    return request.get('/order/waitWeChatPay', { params: { id: id } })
  }
}

export const cheatPayService = (id) => {
  return request.get('/order/cheatPay', { params: { id: id } })
}
